import tensorflow as tf
from tensorflow.python.framework import graph_util
from tensorflow.python.platform import gfile

with tf.Session() as sess:
    with gfile.FastGFile('./demo2/model.pb',mode='rb') as f:
        graph_def = tf.GraphDef()
        graph_def.ParseFromString(f.read())
        sess.graph.as_default()
        tf.import_graph_def(graph_def,name='')
    sess.run(tf.global_variables_initializer())
    print(sess.run(sess.graph.get_tensor_by_name("add_op:0")))
